#version 300 es

layout(location = 0)in vec3 in_position;
layout(location = 1)in vec3 in_normal;
layout(location = 2)in vec3 in_tangent;
layout(location = 3)in vec2 in_uv;

out vec2 frag_uv;
out vec3 frag_world_position;
out vec3 frag_view;
out vec3 frag_normal;
out vec3 frag_tangent;

uniform mat4 curr_model_view_proj;
//uniform mat4 prev_model_view_proj;
uniform mat4 Model;
uniform mat4 ModelInverseTranspose;
uniform vec3 camera_position;

uniform vec2 jitter;

void main()
{
    gl_Position =  curr_model_view_proj * vec4(in_position, 1);
    
    frag_uv = in_uv;
    frag_world_position = (Model * vec4(in_position, 1)).xyz;
    frag_view = camera_position - frag_world_position;
    frag_normal = mat3(ModelInverseTranspose) * in_normal;
    frag_tangent = mat3(ModelInverseTranspose) * in_tangent;
}